package com.acme.bankapp.domain.bank;
import java.util.ArrayList;


/**
 * Class Bank contains aggregate of clients 
 * @author Vasilyev Anton
 *
 */
public class Bank {
	private ArrayList<Client> clients;

	public Bank(ArrayList<Client> clients) {
		this.clients = new ArrayList<Client>(clients);
	}
	
	public Bank() {
		this.clients = new ArrayList<Client>();
	}

	public ArrayList<Client> getClients() {
		return clients;
	}
	
	public void addClient(Client client) {
		clients.add(client);
	}
	
	public Client findClient(Gender gender, String name) {
		for (Client cli: clients) {
			if (cli.getClientSalutation().compareTo(
					new Client(gender, name).getClientSalutation())== 0)
				return cli;
		}
		return null;
	}
	
}
